using System;
using Fornax020.SerialComm.Core;
using Fornax020.SerialComm.Protocol;

namespace Fornax020.SerialComm.Commands
{
    /// <summary>
    /// 清除错误命令
    /// </summary>
    public class ClearErrorCommand : CommandBase
    {
        public ClearErrorCommand()
        {
            Name = "ClearError";
            Description = "清除设备错误状态";
        }

        public override byte[] GetCommandData()
        {
            // 根据协议生成清除错误命令
            // 格式: STX + 'C' + 'L' + CR
            byte[] command = new byte[4];
            command[0] = (byte)ProtocolConstants.STX;  // 起始字节
            command[1] = (byte)'C';  // CL命令
            command[2] = (byte)'L';  // CL命令
            command[3] = (byte)ProtocolConstants.CR;   // 结束字节
            
            return command;
        }
    }
}
